﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Description;

namespace Xtee.Core.Services.Description
{
    public class Header
    {
        public string Name
        {
            get
            {
                if (HeaderType==HeaderType.Input)
                    return Operation.Name + "InputHeader";
                
                return Operation.Name + "OutputHeader";
                
            }
        }

        public List<SoapHeaderBinding> Bindings { get; private set; }
        public Operation Operation { get; private set; }
        public HeaderType HeaderType { get; private set; }
        public ISchemaObjectResolver Resolver { get; private set; }
        public Header(List<SoapHeaderBinding> bindings, Operation operation, HeaderType headerType, ISchemaObjectResolver resolver)
        {
            if (bindings.Count == 0)
                throw new Exception("Header bindings missing for operation " + operation.Name + "!");
            
            Bindings = bindings;
            Operation = operation;
            HeaderType = headerType;
            Resolver = resolver;
        }
        
    }
}
